<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib uri="http://www.springframework.org/security/tags"
	prefix="security"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean"%>
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html"%>
<%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic"%>
<%@ taglib uri="http://struts.apache.org/tags-tiles" prefix="tiles"%>

<style type="text/css">
<!--
.STYLE1 {
	font-size: 12px
}

.STYLE3 {
	color: #707070;
	font-size: 12px;
}

.STYLE5 {
	color: #0a6e0c;
	font-size: 12px;
}

body {
	margin-top: 0px;
	margin-bottom: 0px;
}

.STYLE7 {
	font-size: 12
}
-->
</style>

<script type="text/javascript">
function checkForm() {
	var teachId = document.getElementById("teachId").value;
	
	var nickname = document.getElementById("nickname").value;
	var professional = document.getElementById("professional").value;
	var deptId = document.getElementById("deptId").value;
	var type = document.getElementById("type").value;
	
	if (teachId == null || teacherId == "") {
		alert("请输入教师编号！");
		return false;
	}
	
	if (nickname == null || nickname == "") {
		alert("请输入教师姓名！");
		return false;
	}
	
	if (professional == 0) {
		alert("请选择教师职称！");
		return false;
	}

	if (deptId == 0) {
		alert("请选择所属院系！");
		return false;
	}

	if (type == 0) {
		alert("请选择教师类型！");
		return false;
	}
	
	return true;
}
</script>

<html:form action="teacher.do?method=updateSave" method="post"
	onsubmit="return checkForm();">
	<html:hidden property="userId" value="${teacher.id }" />
	<html:hidden property="password" value="${teacher.password }" />
	<table width="100%" border="0" cellspacing="0" cellpadding="0">
		<tr>
			<td height="30">
			<table width="100%" border="0" cellspacing="0" cellpadding="0">
				<tr>
					<td>&nbsp;</td>
					<td style="padding-right: 10px;">
					<div align="right"></div>
					</td>
				</tr>
			</table>
			</td>
		</tr>
		<tr>
			<td>
			<table width="100%" border="0" cellpadding="0" cellspacing="1"
				bgcolor="#c9c9c9">
				<tr>
					<td width="70%" height="22" bgcolor="#FFFFFF"><strong><span
						class="STYLE1">修改教师</span></strong></td>
			  </tr>
				<tr>
					<td bgcolor="#FFFFFF">
					<table width="700" border="0" align="center" cellpadding="0"
						cellspacing="0">
						<tr>
							<td width="194"  align="right">用户名：</td>
						  <td width="506"><html:text property="username"
								value="${teacher.username }" readonly="true" /><font
								color="red">${usernameError }</font></td>
					  </tr>
						<tr>
							<td align="right">教师编号：</td>
							<td width="506"><html:text property="teachId"
								value="${teacher.teachId }" /><font color="red">${teachId
							}</font><font color="red">${teachIdRequest }</font></td>
					  </tr>
						<tr>
							<td align="right">教师姓名：</td>
							<td><html:text property="nickname"
								value="${teacher.nickname}" /><font color="red">${nicknameError
							}</font></td>
						</tr>
						<tr>
							<td align="right">教师职称：</td>
							<td><html:select property="professional"
								value="${teacher.professional}">
								<html:option value="0">请选择</html:option>
								<html:option value="助教">助教</html:option>
								<html:option value="讲师"> 讲师</html:option>
								<html:option value="副教授">副教授</html:option>
								<html:option value="教授">教授</html:option>
							</html:select><font color="red">${prifessionalError }</font></td>
						</tr>
						<tr>
							<td align="right">教师类型：</td>
							<td><html:select property="type" value="${teacher.type }">
								<html:option value="0">请选择</html:option>
								<html:option value="1">专任教师</html:option>
								<html:option value="2">行政人员</html:option>
								<html:option value="3">兼职教师</html:option>
							</html:select><font color="red">${typeError }</font></td>
						</tr>						
						<security:authorize ifAnyGranted="ROLE_DEPT_ADMIN">
							<tr>
								<td align="right">所属院系:</td>
								<td>
								<html:select property="deptId">
											<html:option value="${department.id}">${department.deptName}</html:option>
								</html:select><font color="red">${deptError }</font>								</td>
							</tr>
						</security:authorize>
						<security:authorize ifAnyGranted="ROLE_ADMIN">
							<tr>
								<td align="right">所属院系：</td>
								<td><html:select property="deptId">
									<c:if test="${!empty deptList}">
										<c:forEach items="${deptList}" var="dept">
											<html:option value="${dept.id}">${dept.deptName}</html:option>
										</c:forEach>
									</c:if>
								</html:select><font color="red">${deptError }</font></td>
							</tr>
						</security:authorize>
						<tr>
							<td>&nbsp;</td>
							<td>&nbsp;</td>
						</tr>
						<tr>
							<td align="center">&nbsp;</td>
							<td><html:submit value="确认修改" /> &nbsp;&nbsp;&nbsp; <html:reset
								value="取 消" /></td>
						</tr>
					</table>					</td>
				</tr>
			</table>
		  </td>
		</tr>
		<tr>
			<td height="35">&nbsp;</td>
		</tr>
	</table>
</html:form>